package com.csdj.controller.Be;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.csdj.common.utils.ResponseResult;
import com.csdj.pojo.BeFlow;
import com.csdj.service.BeFlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 涵哥
 * @date 2023-08-29 10:34
 */
@RestController
@RequestMapping("/be/flow")
public class BeFlowController {

    @Autowired
    private BeFlowService beFlowService;

    /**
     * 拿到第一步到第八步的流程
     * @return
     */
    @GetMapping
    public ResponseResult list(){
        List<BeFlow> list = beFlowService.list(Wrappers.<BeFlow>lambdaQuery().gt(BeFlow::getId, 0));
        return ResponseResult.okResult(list);
    }

    /**
     * 批量修改流程配置
     * @param arrayList
     * @return
     */
    @PutMapping("/batchUpdate")
    public ResponseResult batchUpdate(@RequestBody ArrayList<BeFlow> arrayList){
        return ResponseResult.okResult(beFlowService.updateBatchById(arrayList));
    }
}
